package io.adrainty.bolee.trade.models.entity;

import io.adrainty.bolee.framework.commons.basic.BaseEntity;
import io.adrainty.bolee.trade.models.ali.AliPeriodicDTO;
import io.adrainty.bolee.trade.models.valobj.TradeStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.io.Serial;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * <p>TradeEntity</p>
 *
 * @author AdRainty
 * @version V1.0.0
 * @description TradeEntity
 * @since 2025/8/28 13:34:03
 */

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "交易")
@EqualsAndHashCode(callSuper = true)
public class TradeEntity extends BaseEntity {
    
    @Serial
    private static final long serialVersionUID = -2896702031108388996L;

    @Schema(description = "openId标识")
    private String openId;

    @Schema(description = "业务系统订单号")
    private Long productOrderNo;

    @Schema(description = "交易系统订单号【对于三方来说：商户订单】")
    private Long tradeOrderNo;

    @Schema(description = "支付渠道【支付宝、微信】")
    private String tradeChannel;

    @Schema(description = "交易单状态0待付款 1已支付 2已关闭）")
    private TradeStatusEnum tradeState;

    @Schema(description = "收款人姓名")
    private String payeeName;

    @Schema(description = "收款人账户ID")
    private Long payeeId;

    @Schema(description = "付款人姓名")
    private String payerName;

    @Schema(description = "付款人Id")
    private Long payerId;

    @Schema(description = "交易金额")
    private BigDecimal tradeAmount;

    @Schema(description = "退款总金额")
    private BigDecimal refund;

    @Schema(description = "是否有退款：0，1")
    private String isRefund;

    @Schema(description = "第三方交易返回编码【最终确认交易结果】")
    private String resultCode;

    @Schema(description = "第三方交易返回提示消息【最终确认交易信息】")
    private String resultMsg;

    @Schema(description = "第三方交易返回信息json【分析交易最终信息】")
    private String resultJson;

    @Schema(description = "统一下单返回编码")
    private String placeOrderCode;

    @Schema(description = "统一下单返回信息")
    private String placeOrderMsg;

    @Schema(description = "统一下单返回信息json【用于生产二维码、Android ios唤醒支付等】")
    private String placeOrderJson;

    @Schema(description = "备注【订单门店，桌台信息】")
    private String memo;

    @Schema(description = "二维码base64")
    private String qrCodeImageBase64;

    @Schema(description = "退款请求号")
    private String outRequestNo;

    @Schema(description = "本次退款金额")
    private BigDecimal operTionRefund;

    @Schema(description = "支付授权码")
    private String authCode;

    @Schema(description = "支付宝：HTTP/HTTPS开头字符串")
    private String quitUrl;

    @Schema(description = "支付宝：用户付款中途退出返回商户网站的地址")
    private String returnUrl;

    @Schema(description = "支付宝：异步通知地址")
    private String notifyUrl;

    @Schema(description = "账单类型，商户通过接口或商户经开放平台授权后其所属服务商通过接口可以获取以下账单类型")
    private String billType;

    @Schema(description = "账单时间:日账单格式为yyyy-MM-dd，最早可下载2016年1月1日开始的日账单。不支持下载当日账单，只能下载前一日24点前的账单数据（T+1）")
    protected LocalDate billDate;

    @Schema(description = "账单地址")
    private String billDownloadUrl;

    @Schema(description = "商户ID【系统内部识别使用】")
    private String companyNo;

    @Schema(description = "退款记录")
    private List<RefundRecordEntity> refundRecordVOList;

    @Schema(description = "阿里APP周期扣款签约参数对象")
    private AliPeriodicDTO aliPeriodicVO;
    
}
